﻿using System;
using Microsoft.Xna.Framework;

namespace Main.lib.util
{

    public static class Util
    {

        /**
         * Util.Min
         * 
         * Substitute for Math.Min(Math.Min(Math.Min(...
         */
        public static byte    Min(params byte[]    Values)
        {
            byte Value = Values[0];
            for (int i = 1; i < Values.Length; i++)
                Value = Math.Min(Value, Values[i]);
            return Value;
        }
        public static decimal Min(params decimal[] Values)
        {
            decimal Value = Values[0];
            for (int i = 1; i < Values.Length; i++)
                Value = Math.Min(Value, Values[i]);
            return Value;
        }
        public static double  Min(params double[]  Values)
        {
            double Value = Values[0];
            for (int i = 1; i < Values.Length; i++)
                Value = Math.Min(Value, Values[i]);
            return Value;
        }
        public static float   Min(params float[]   Values)
        {
            float Value = Values[0];
            for (int i = 1; i < Values.Length; i++)
                Value = Math.Min(Value, Values[i]);
            return Value;
        }
        public static int     Min(params int[]     Values)
        {
            int Value = Values[0];
            for (int i = 1; i < Values.Length; i++)
                Value = Math.Min(Value, Values[i]);
            return Value;
        }
        public static long    Min(params long[]    Values)
        {
            long Value = Values[0];
            for (int i = 1; i < Values.Length; i++)
                Value = Math.Min(Value, Values[i]);
            return Value;
        }
        public static sbyte   Min(params sbyte[]   Values)
        {
            sbyte Value = Values[0];
            for (int i = 1; i < Values.Length; i++)
                Value = Math.Min(Value, Values[i]);
            return Value;
        }
        public static short   Min(params short[]   Values)
        {
            short Value = Values[0];
            for (int i = 1; i < Values.Length; i++)
                Value = Math.Min(Value, Values[i]);
            return Value;
        }
        public static uint    Min(params uint[]    Values)
        {
            uint Value = Values[0];
            for (int i = 1; i < Values.Length; i++)
                Value = Math.Min(Value, Values[i]);
            return Value;
        }
        public static ulong   Min(params ulong[]   Values)
        {
            ulong Value = Values[0];
            for (int i = 1; i < Values.Length; i++)
                Value = Math.Min(Value, Values[i]);
            return Value;
        }
        public static ushort  Min(params ushort[]  Values)
        {
            ushort Value = Values[0];
            for (int i = 1; i < Values.Length; i++)
                Value = Math.Min(Value, Values[i]);
            return Value;
        }

        /**
         * Util.Max
         * 
         * Substitute for Math.Max(Math.Max(Math.Max(...
         */
        public static byte    Max(params byte[]    Values)
        {
            byte Value = Values[0];
            for (int i = 1; i < Values.Length; i++)
                Value = Math.Max(Value, Values[i]);
            return Value;
        }
        public static decimal Max(params decimal[] Values)
        {
            decimal Value = Values[0];
            for (int i = 1; i < Values.Length; i++)
                Value = Math.Max(Value, Values[i]);
            return Value;
        }
        public static double  Max(params double[]  Values)
        {
            double Value = Values[0];
            for (int i = 1; i < Values.Length; i++)
                Value = Math.Max(Value, Values[i]);
            return Value;
        }
        public static float   Max(params float[]   Values)
        {
            float Value = Values[0];
            for (int i = 1; i < Values.Length; i++)
                Value = Math.Max(Value, Values[i]);
            return Value;
        }
        public static int     Max(params int[]     Values)
        {
            int Value = Values[0];
            for (int i = 1; i < Values.Length; i++)
                Value = Math.Max(Value, Values[i]);
            return Value;
        }
        public static long    Max(params long[]    Values)
        {
            long Value = Values[0];
            for (int i = 1; i < Values.Length; i++)
                Value = Math.Max(Value, Values[i]);
            return Value;
        }
        public static sbyte   Max(params sbyte[]   Values)
        {
            sbyte Value = Values[0];
            for (int i = 1; i < Values.Length; i++)
                Value = Math.Max(Value, Values[i]);
            return Value;
        }
        public static short   Max(params short[]   Values)
        {
            short Value = Values[0];
            for (int i = 1; i < Values.Length; i++)
                Value = Math.Max(Value, Values[i]);
            return Value;
        }
        public static uint    Max(params uint[]    Values)
        {
            uint Value = Values[0];
            for (int i = 1; i < Values.Length; i++)
                Value = Math.Max(Value, Values[i]);
            return Value;
        }
        public static ulong   Max(params ulong[]   Values)
        {
            ulong Value = Values[0];
            for (int i = 1; i < Values.Length; i++)
                Value = Math.Max(Value, Values[i]);
            return Value;
        }
        public static ushort  Max(params ushort[]  Values)
        {
            ushort Value = Values[0];
            for (int i = 1; i < Values.Length; i++)
                Value = Math.Max(Value, Values[i]);
            return Value;
        }

        /**
         * Util.SinCosTan
         * 
         * Couple of funtions which can do sin / cos / tan at the same time
         */
        public static double[] SinCos   (double Angle)
        {
            double[] Values = new double[2];
            Values[0] = Math.Sin(Angle);
            Values[1] = Math.Cos(Angle);
            return Values;
        }
        public static double[] SinTan   (double Angle)
        {
            double[] Values = new double[2];
            Values[0] = Math.Sin(Angle);
            Values[1] = Math.Tan(Angle);
            return Values;
        }
        public static double[] CosTan   (double Angle)
        {
            double[] Values = new double[2];
            Values[0] = Math.Cos(Angle);
            Values[1] = Math.Tan(Angle);
            return Values;
        }
        public static double[] SinCosTan(double Angle)
        {
            double[] Values = new double[3];
            Values[0] = Math.Sin(Angle);
            Values[1] = Math.Cos(Angle);
            Values[2] = Math.Tan(Angle);
            return Values;
        }

        /**
         * Util.DegreeToRadian
         * 
         * Angle conversion
         */
        public static double DegreeToRadian(double Angle)
        {
            return Angle * 0.0174532925;
        }
        public static double RadianToDegree(double Angle)
        {
            return Angle * 57.2957795785523;
        }




    }

}